﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Inspire.Entities
{
    public partial class CustomStringField : CustomField
    {
        /// <summary>
        /// Returns the value of this field as an object.
        /// </summary>
        /// <returns>(object) The value of this field.</returns>
        public override object GetData()
        {
            return this.Data;
        }

        /// <summary>
        /// Implementation of the abstract SetData method for the CustomStringField class.
        /// </summary>
        /// <param name="data"></param>
        public override void SetData(Object data)
        {
            if (data is String)
            {
                this.Data = (String)data;
            }
        }

        /// <summary>
        /// Returns the value of this field or "Null" if the value is null.
        /// </summary>
        /// <returns>(string) The value of this field or "Null" if the value is null.</returns>
        public override string ToString()
        {
            if (this.Data != null)
            {
                return this.Data;
            }

            return "Null";
        }
    }
}
